
package com.sword.invoice.spring;

import com.sword.common.strategy.ISCommonStrategy;
import com.sword.invoice.InvoiceManager;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 组件注入注入 所需要的 Bean
 * src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
 * 是 Spring Boot 2.7+ 中引入的一种新的 自动配置加载机制
 */
public class SwordBeanInject {
	/**
	 * 注入持久化Bean
	 * 
	 * @param repository 实现对象
	 */
	@Autowired(required = false)
	public void setISInvoiceDriverRepository(List<ISCommonStrategy> repository) {
		if(repository!=null){
			repository.forEach(bean ->	InvoiceManager.setISInvoiceDriverRepository(bean));
		}
	}


}
